AtCoder Beginner Contest 197 D
種別: 記事
カテゴリ: 競技プログラミング
サブカテゴリ: AtCoder > AtCoder Beginner Contest 197
タグ: #解いた問題
(工事中)
2021年3月27日にAtCoder で開催されたコンテストであるAtCoder Beginner Contest 197 のD問題に関するメモ
解き方
解答例
下は上記の方法で解いたときの提出結果である。また、その提出の際に提出したソースコードをその下に転記する。
code: C
#include <stdio.h>
#include <math.h>
int main () {
int n = 0;
int x = 0;
int y = 0;
int x_op = 0;
int y_op = 0;
double x_cnt = 0.0;
double y_cnt = 0.0;
double x_1 = 0.0;
double y_1 = 0.0;
int res = 0;
int min = 1073741824;
res = scanf("%d", &n);
res = scanf("%d", &x);
res = scanf("%d", &y);
res = scanf("%d", &x_op);
res = scanf("%d", &y_op);
x_cnt = ((double) (x_op - x)) / 2 + x;
y_cnt = ((double) (y_op - y)) / 2 + y;
x_1 = (x - x_cnt) * cos(M_PI / (n / 2)) - (y - y_cnt) * sin(M_PI / (n / 2)) + x_cnt;
y_1 = (x - x_cnt) * sin(M_PI / (n / 2)) + (y - y_cnt) * cos(M_PI / (n / 2)) + y_cnt;
printf("%.16lf %.16lf\n",x_1,y_1);
return 0;
}
私の提出一覧
table: submissions_atcoder_begginer_contest_197_D
提出のURL 提出時刻 結果 備考
1回目 https://atcoder.jp/contests/abc197/submissions/21316915 2021-03-27T22:10:55+0900 AC
感想